$(function(){
    // 头部时间
    function getTime(){
        let times=new Date()
        let year=times.getFullYear()
        let month=times.getMonth()+1
        let date=times.getDate()
        let hours=times.getHours()
        let minutes=times.getMinutes()
        let seconds=times.getSeconds()
        hours=hours<10?'0'+hours:hours
        minutes=minutes<10?'0'+minutes:minutes
        seconds=seconds<10?'0'+seconds:seconds
        let setTime=year+'年'+month+'月'+date+'日'+hours+':'+minutes+':'+seconds
        $('.action-time').text(setTime)
    }
    setInterval(getTime,1000)

    // 左侧菜单
    function getMenu(){
        $('.aside-box li').click(function(){
            $(this).addClass('active').siblings('li').removeClass('active')
        })
    }
    getMenu()
    //天气
    // $.get("https://free-api.heweather.com/s6/weather?location=auto_ip&key=a254e7178ce645038748a23a07664bf2", function(result) {
    //     let basic = result.HeWeather6[0];
    //     let today = basic.daily_forecast[0];
    //     let city = basic.basic.parent_city
    //     let weather,tmp;
    //     // $('#weatherImg').attr('src',`https://cdn.heweather.com/cond_icon/${today.cond_code_d}.png`)
    //     console.log(today)
    //     if (today.cond_txt_d == today.cond_txt_n) {
    //         weather =today.cond_txt_d;
    //     } else {
    //         weather=today.cond_txt_d + "转" + today.cond_txt_n
    //     };
    //     tmp =today.tmp_min + "/" + today.tmp_max + '°C';
    //     $('.header-box .weather-box span').text(city+" "+weather+" "+tmp)

    // })
  $('.header-box .weather-box span').text('郑州市 晴 12/22℃')
  $('.header-box .weather-box').append(`<img src="../../images/sun.png" />`)

})
